//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS DocDBElastic service.
///
/// Amazon DocumentDB elastic clusters Amazon DocumentDB elastic-clusters support workloads with millions of reads/writes per second and petabytes of storage capacity.  Amazon DocumentDB elastic clusters also simplify how developers interact with Amazon DocumentDB elastic-clusters by eliminating the need to choose, manage or upgrade instances. Amazon DocumentDB elastic-clusters were created to:   provide a solution for customers looking for a database that provides virtually limitless scale with rich query capabilities and MongoDB API compatibility.   give customers higher connection limits, and to reduce downtime from patching.   continue investing in a cloud-native, elastic, and class leading architecture for JSON workloads.
public struct DocDBElastic: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the DocDBElastic client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "DocDBElastic",
            serviceIdentifier: "docdb-elastic",
            serviceProtocol: .restjson,
            apiVersion: "2022-11-28",
            endpoint: endpoint,
            errorType: DocDBElasticErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// The type of pending maintenance action to be applied to the resource.
    @Sendable
    @inlinable
    public func applyPendingMaintenanceAction(_ input: ApplyPendingMaintenanceActionInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ApplyPendingMaintenanceActionOutput {
        try await self.client.execute(
            operation: "ApplyPendingMaintenanceAction", 
            path: "/pending-action", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// The type of pending maintenance action to be applied to the resource.
    ///
    /// Parameters:
    ///   - applyAction: The pending maintenance action to apply to the resource. Valid actions are:    ENGINE_UPDATE      ENGINE_UPGRADE     SECURITY_UPDATE     OS_UPDATE     MASTER_USER_PASSWORD_UPDATE
    ///   - applyOn: A specific date to apply the pending maintenance action. Required if opt-in-type is APPLY_ON. Format: yyyy/MM/dd HH:mm-yyyy/MM/dd HH:mm
    ///   - optInType: A value that specifies the type of opt-in request, or undoes an opt-in request. An opt-in request of type IMMEDIATE can't be undone.
    ///   - resourceArn: The Amazon DocumentDB Amazon Resource Name (ARN) of the resource to which the pending maintenance action applies.
    ///   - logger: Logger use during operation
    @inlinable
    public func applyPendingMaintenanceAction(
        applyAction: String,
        applyOn: String? = nil,
        optInType: OptInType,
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ApplyPendingMaintenanceActionOutput {
        let input = ApplyPendingMaintenanceActionInput(
            applyAction: applyAction, 
            applyOn: applyOn, 
            optInType: optInType, 
            resourceArn: resourceArn
        )
        return try await self.applyPendingMaintenanceAction(input, logger: logger)
    }

    /// Copies a snapshot of an elastic cluster.
    @Sendable
    @inlinable
    public func copyClusterSnapshot(_ input: CopyClusterSnapshotInput, logger: Logger = AWSClient.loggingDisabled) async throws -> CopyClusterSnapshotOutput {
        try await self.client.execute(
            operation: "CopyClusterSnapshot", 
            path: "/cluster-snapshot/{snapshotArn}/copy", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Copies a snapshot of an elastic cluster.
    ///
    /// Parameters:
    ///   - copyTags: Set to true to copy all tags from the source cluster snapshot to the target elastic cluster snapshot.  The default is false.
    ///   - kmsKeyId: The Amazon Web Services KMS key ID for an encrypted elastic cluster snapshot.  The Amazon Web Services KMS key ID is the Amazon Resource Name (ARN), Amazon Web Services KMS key identifier, or the Amazon Web Services KMS key alias for the Amazon Web Services KMS encryption key. If you copy an encrypted elastic cluster snapshot from your Amazon Web Services account, you can specify a value for KmsKeyId to encrypt the copy with a new Amazon Web ServicesS KMS encryption key.  If you don't specify a value for KmsKeyId, then the copy of the elastic cluster snapshot is encrypted with the same AWS KMS key as the source elastic cluster snapshot. To copy an encrypted elastic cluster snapshot to another Amazon Web Services region, set KmsKeyId to the Amazon Web Services KMS key ID that you want to use to encrypt the copy of the elastic cluster snapshot in the destination region.  Amazon Web Services KMS encryption keys are specific to the Amazon Web Services region that they are created in, and you can't use encryption keys from one Amazon Web Services region in another Amazon Web Services region. If you copy an unencrypted elastic cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.
    ///   - snapshotArn: The Amazon Resource Name (ARN) identifier of the elastic cluster snapshot.
    ///   - tags: The tags to be assigned to the elastic cluster snapshot.
    ///   - targetSnapshotName: The identifier of the new elastic cluster snapshot to create from the source cluster snapshot.  This parameter is not case sensitive. Constraints:   Must contain from 1 to 63 letters, numbers, or hyphens.   The first character must be a letter.   Cannot end with a hyphen or contain two consecutive hyphens.   Example: elastic-cluster-snapshot-5
    ///   - logger: Logger use during operation
    @inlinable
    public func copyClusterSnapshot(
        copyTags: Bool? = nil,
        kmsKeyId: String? = nil,
        snapshotArn: String,
        tags: [String: String]? = nil,
        targetSnapshotName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CopyClusterSnapshotOutput {
        let input = CopyClusterSnapshotInput(
            copyTags: copyTags, 
            kmsKeyId: kmsKeyId, 
            snapshotArn: snapshotArn, 
            tags: tags, 
            targetSnapshotName: targetSnapshotName
        )
        return try await self.copyClusterSnapshot(input, logger: logger)
    }

    /// Creates a new Amazon DocumentDB elastic cluster and returns its cluster structure.
    @Sendable
    @inlinable
    public func createCluster(_ input: CreateClusterInput, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateClusterOutput {
        try await self.client.execute(
            operation: "CreateCluster", 
            path: "/cluster", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a new Amazon DocumentDB elastic cluster and returns its cluster structure.
    ///
    /// Parameters:
    ///   - adminUserName: The name of the Amazon DocumentDB elastic clusters administrator.  Constraints:   Must be from 1 to 63 letters or numbers.   The first character must be a letter.   Cannot be a reserved word.
    ///   - adminUserPassword: The password for the Amazon DocumentDB elastic clusters administrator. The password can contain any printable ASCII characters.  Constraints:   Must contain from 8 to 100 characters.   Cannot contain a forward slash (/), double quote ("), or the "at" symbol (@).
    ///   - authType: The authentication type used to determine where to fetch the password used for accessing the elastic cluster.  Valid types are PLAIN_TEXT or SECRET_ARN.
    ///   - backupRetentionPeriod: The number of days for which automatic snapshots are retained.
    ///   - clientToken: The client token for the elastic cluster.
    ///   - clusterName: The name of the new elastic cluster. This parameter is stored as a lowercase string.  Constraints:   Must contain from 1 to 63 letters, numbers, or hyphens.   The first character must be a letter.   Cannot end with a hyphen or contain two consecutive hyphens.    Example: my-cluster
    ///   - kmsKeyId: The KMS key identifier to use to encrypt the new elastic cluster. The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key. If an encryption key is not specified, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.
    ///   - preferredBackupWindow: The daily time range during which automated backups are created if automated backups are enabled, as determined by the backupRetentionPeriod.
    ///   - preferredMaintenanceWindow: The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).  Format: ddd:hh24:mi-ddd:hh24:mi   Default: a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week.  Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun  Constraints: Minimum 30-minute window.
    ///   - shardCapacity: The number of vCPUs assigned to each elastic cluster shard. Maximum is 64. Allowed values are 2, 4, 8, 16, 32, 64.
    ///   - shardCount: The number of shards assigned to the elastic cluster. Maximum is 32.
    ///   - shardInstanceCount: The number of replica instances applying to all shards in the elastic cluster.  A shardInstanceCount value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.
    ///   - subnetIds: The Amazon EC2 subnet IDs for the new elastic cluster.
    ///   - tags: The tags to be assigned to the new elastic cluster.
    ///   - vpcSecurityGroupIds: A list of EC2 VPC security groups to associate with the new elastic cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func createCluster(
        adminUserName: String,
        adminUserPassword: String,
        authType: Auth,
        backupRetentionPeriod: Int? = nil,
        clientToken: String? = CreateClusterInput.idempotencyToken(),
        clusterName: String,
        kmsKeyId: String? = nil,
        preferredBackupWindow: String? = nil,
        preferredMaintenanceWindow: String? = nil,
        shardCapacity: Int,
        shardCount: Int,
        shardInstanceCount: Int? = nil,
        subnetIds: [String]? = nil,
        tags: [String: String]? = nil,
        vpcSecurityGroupIds: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateClusterOutput {
        let input = CreateClusterInput(
            adminUserName: adminUserName, 
            adminUserPassword: adminUserPassword, 
            authType: authType, 
            backupRetentionPeriod: backupRetentionPeriod, 
            clientToken: clientToken, 
            clusterName: clusterName, 
            kmsKeyId: kmsKeyId, 
            preferredBackupWindow: preferredBackupWindow, 
            preferredMaintenanceWindow: preferredMaintenanceWindow, 
            shardCapacity: shardCapacity, 
            shardCount: shardCount, 
            shardInstanceCount: shardInstanceCount, 
            subnetIds: subnetIds, 
            tags: tags, 
            vpcSecurityGroupIds: vpcSecurityGroupIds
        )
        return try await self.createCluster(input, logger: logger)
    }

    /// Creates a snapshot of an elastic cluster.
    @Sendable
    @inlinable
    public func createClusterSnapshot(_ input: CreateClusterSnapshotInput, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateClusterSnapshotOutput {
        try await self.client.execute(
            operation: "CreateClusterSnapshot", 
            path: "/cluster-snapshot", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a snapshot of an elastic cluster.
    ///
    /// Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster of which you want to create a snapshot.
    ///   - snapshotName: The name of the new elastic cluster snapshot.
    ///   - tags: The tags to be assigned to the new elastic cluster snapshot.
    ///   - logger: Logger use during operation
    @inlinable
    public func createClusterSnapshot(
        clusterArn: String,
        snapshotName: String,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateClusterSnapshotOutput {
        let input = CreateClusterSnapshotInput(
            clusterArn: clusterArn, 
            snapshotName: snapshotName, 
            tags: tags
        )
        return try await self.createClusterSnapshot(input, logger: logger)
    }

    /// Delete an elastic cluster.
    @Sendable
    @inlinable
    public func deleteCluster(_ input: DeleteClusterInput, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteClusterOutput {
        try await self.client.execute(
            operation: "DeleteCluster", 
            path: "/cluster/{clusterArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Delete an elastic cluster.
    ///
    /// Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster that is to be deleted.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteCluster(
        clusterArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteClusterOutput {
        let input = DeleteClusterInput(
            clusterArn: clusterArn
        )
        return try await self.deleteCluster(input, logger: logger)
    }

    /// Delete an elastic cluster snapshot.
    @Sendable
    @inlinable
    public func deleteClusterSnapshot(_ input: DeleteClusterSnapshotInput, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteClusterSnapshotOutput {
        try await self.client.execute(
            operation: "DeleteClusterSnapshot", 
            path: "/cluster-snapshot/{snapshotArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Delete an elastic cluster snapshot.
    ///
    /// Parameters:
    ///   - snapshotArn: The ARN identifier of the elastic cluster snapshot that is to be deleted.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteClusterSnapshot(
        snapshotArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteClusterSnapshotOutput {
        let input = DeleteClusterSnapshotInput(
            snapshotArn: snapshotArn
        )
        return try await self.deleteClusterSnapshot(input, logger: logger)
    }

    /// Returns information about a specific elastic cluster.
    @Sendable
    @inlinable
    public func getCluster(_ input: GetClusterInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetClusterOutput {
        try await self.client.execute(
            operation: "GetCluster", 
            path: "/cluster/{clusterArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about a specific elastic cluster.
    ///
    /// Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func getCluster(
        clusterArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetClusterOutput {
        let input = GetClusterInput(
            clusterArn: clusterArn
        )
        return try await self.getCluster(input, logger: logger)
    }

    /// Returns information about a specific elastic cluster snapshot
    @Sendable
    @inlinable
    public func getClusterSnapshot(_ input: GetClusterSnapshotInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetClusterSnapshotOutput {
        try await self.client.execute(
            operation: "GetClusterSnapshot", 
            path: "/cluster-snapshot/{snapshotArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about a specific elastic cluster snapshot
    ///
    /// Parameters:
    ///   - snapshotArn: The ARN identifier of the elastic cluster snapshot.
    ///   - logger: Logger use during operation
    @inlinable
    public func getClusterSnapshot(
        snapshotArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetClusterSnapshotOutput {
        let input = GetClusterSnapshotInput(
            snapshotArn: snapshotArn
        )
        return try await self.getClusterSnapshot(input, logger: logger)
    }

    /// Retrieves all maintenance actions that are pending.
    @Sendable
    @inlinable
    public func getPendingMaintenanceAction(_ input: GetPendingMaintenanceActionInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetPendingMaintenanceActionOutput {
        try await self.client.execute(
            operation: "GetPendingMaintenanceAction", 
            path: "/pending-action/{resourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves all maintenance actions that are pending.
    ///
    /// Parameters:
    ///   - resourceArn: Retrieves pending maintenance actions for a specific Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func getPendingMaintenanceAction(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetPendingMaintenanceActionOutput {
        let input = GetPendingMaintenanceActionInput(
            resourceArn: resourceArn
        )
        return try await self.getPendingMaintenanceAction(input, logger: logger)
    }

    /// Returns information about snapshots for a specified elastic cluster.
    @Sendable
    @inlinable
    public func listClusterSnapshots(_ input: ListClusterSnapshotsInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListClusterSnapshotsOutput {
        try await self.client.execute(
            operation: "ListClusterSnapshots", 
            path: "/cluster-snapshots", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about snapshots for a specified elastic cluster.
    ///
    /// Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster.
    ///   - maxResults: The maximum number of elastic cluster snapshot results to receive in the response.
    ///   - nextToken: A pagination token provided by a previous request.  If this parameter is specified, the response includes only records beyond this token, up to the value specified by max-results. If there is no more data in the responce, the nextToken will not be returned.
    ///   - snapshotType: The type of cluster snapshots to be returned. You can specify one of the following values:    automated - Return all cluster snapshots that Amazon DocumentDB has automatically created for your Amazon Web Services account.    manual - Return all cluster snapshots that you have manually created for your Amazon Web Services account.
    ///   - logger: Logger use during operation
    @inlinable
    public func listClusterSnapshots(
        clusterArn: String? = nil,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        snapshotType: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListClusterSnapshotsOutput {
        let input = ListClusterSnapshotsInput(
            clusterArn: clusterArn, 
            maxResults: maxResults, 
            nextToken: nextToken, 
            snapshotType: snapshotType
        )
        return try await self.listClusterSnapshots(input, logger: logger)
    }

    /// Returns information about provisioned Amazon DocumentDB elastic clusters.
    @Sendable
    @inlinable
    public func listClusters(_ input: ListClustersInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListClustersOutput {
        try await self.client.execute(
            operation: "ListClusters", 
            path: "/clusters", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about provisioned Amazon DocumentDB elastic clusters.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of elastic cluster snapshot results to receive in the response.
    ///   - nextToken: A pagination token provided by a previous request.  If this parameter is specified, the response includes only records beyond this token, up to the value specified by max-results. If there is no more data in the responce, the nextToken will not be returned.
    ///   - logger: Logger use during operation
    @inlinable
    public func listClusters(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListClustersOutput {
        let input = ListClustersInput(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listClusters(input, logger: logger)
    }

    /// Retrieves a list of all maintenance actions that are pending.
    @Sendable
    @inlinable
    public func listPendingMaintenanceActions(_ input: ListPendingMaintenanceActionsInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListPendingMaintenanceActionsOutput {
        try await self.client.execute(
            operation: "ListPendingMaintenanceActions", 
            path: "/pending-actions", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves a list of all maintenance actions that are pending.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of results to include in the response.  If more records exist than the specified maxResults value, a pagination token (marker) is included in the response so that the remaining results can be retrieved.
    ///   - nextToken: An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by maxResults.
    ///   - logger: Logger use during operation
    @inlinable
    public func listPendingMaintenanceActions(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListPendingMaintenanceActionsOutput {
        let input = ListPendingMaintenanceActionsInput(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listPendingMaintenanceActions(input, logger: logger)
    }

    /// Lists all tags on a elastic cluster resource
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all tags on a elastic cluster resource
    ///
    /// Parameters:
    ///   - resourceArn: The ARN identifier of the elastic cluster resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Restores an elastic cluster from a snapshot.
    @Sendable
    @inlinable
    public func restoreClusterFromSnapshot(_ input: RestoreClusterFromSnapshotInput, logger: Logger = AWSClient.loggingDisabled) async throws -> RestoreClusterFromSnapshotOutput {
        try await self.client.execute(
            operation: "RestoreClusterFromSnapshot", 
            path: "/cluster-snapshot/{snapshotArn}/restore", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Restores an elastic cluster from a snapshot.
    ///
    /// Parameters:
    ///   - clusterName: The name of the elastic cluster.
    ///   - kmsKeyId: The KMS key identifier to use to encrypt the new Amazon DocumentDB elastic clusters cluster. The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key. If an encryption key is not specified here, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.
    ///   - shardCapacity: The capacity of each shard in the new restored elastic cluster.
    ///   - shardInstanceCount: The number of replica instances applying to all shards in the elastic cluster.  A shardInstanceCount value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.
    ///   - snapshotArn: The ARN identifier of the elastic cluster snapshot.
    ///   - subnetIds: The Amazon EC2 subnet IDs for the elastic cluster.
    ///   - tags: A list of the tag names to be assigned to the restored elastic cluster, in the form of an array of key-value pairs in which the key is the tag name and the value is the key value.
    ///   - vpcSecurityGroupIds: A list of EC2 VPC security groups to associate with the elastic cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func restoreClusterFromSnapshot(
        clusterName: String,
        kmsKeyId: String? = nil,
        shardCapacity: Int? = nil,
        shardInstanceCount: Int? = nil,
        snapshotArn: String,
        subnetIds: [String]? = nil,
        tags: [String: String]? = nil,
        vpcSecurityGroupIds: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RestoreClusterFromSnapshotOutput {
        let input = RestoreClusterFromSnapshotInput(
            clusterName: clusterName, 
            kmsKeyId: kmsKeyId, 
            shardCapacity: shardCapacity, 
            shardInstanceCount: shardInstanceCount, 
            snapshotArn: snapshotArn, 
            subnetIds: subnetIds, 
            tags: tags, 
            vpcSecurityGroupIds: vpcSecurityGroupIds
        )
        return try await self.restoreClusterFromSnapshot(input, logger: logger)
    }

    /// Restarts the stopped elastic cluster that is specified by clusterARN.
    @Sendable
    @inlinable
    public func startCluster(_ input: StartClusterInput, logger: Logger = AWSClient.loggingDisabled) async throws -> StartClusterOutput {
        try await self.client.execute(
            operation: "StartCluster", 
            path: "/cluster/{clusterArn}/start", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Restarts the stopped elastic cluster that is specified by clusterARN.
    ///
    /// Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func startCluster(
        clusterArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartClusterOutput {
        let input = StartClusterInput(
            clusterArn: clusterArn
        )
        return try await self.startCluster(input, logger: logger)
    }

    /// Stops the running elastic cluster that is specified by clusterArn.  The elastic cluster must be in the available state.
    @Sendable
    @inlinable
    public func stopCluster(_ input: StopClusterInput, logger: Logger = AWSClient.loggingDisabled) async throws -> StopClusterOutput {
        try await self.client.execute(
            operation: "StopCluster", 
            path: "/cluster/{clusterArn}/stop", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Stops the running elastic cluster that is specified by clusterArn.  The elastic cluster must be in the available state.
    ///
    /// Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func stopCluster(
        clusterArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StopClusterOutput {
        let input = StopClusterInput(
            clusterArn: clusterArn
        )
        return try await self.stopCluster(input, logger: logger)
    }

    /// Adds metadata tags to an elastic cluster resource
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> TagResourceResponse {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Adds metadata tags to an elastic cluster resource
    ///
    /// Parameters:
    ///   - resourceArn: The ARN identifier of the elastic cluster resource.
    ///   - tags: The tags that are assigned to the elastic cluster resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> TagResourceResponse {
        let input = TagResourceRequest(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Removes metadata tags from an elastic cluster resource
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UntagResourceResponse {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes metadata tags from an elastic cluster resource
    ///
    /// Parameters:
    ///   - resourceArn: The ARN identifier of the elastic cluster resource.
    ///   - tagKeys: The tag keys to be removed from the elastic cluster resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UntagResourceResponse {
        let input = UntagResourceRequest(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Modifies an elastic cluster. This includes updating admin-username/password,  upgrading the API version, and setting up a backup window and maintenance window
    @Sendable
    @inlinable
    public func updateCluster(_ input: UpdateClusterInput, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateClusterOutput {
        try await self.client.execute(
            operation: "UpdateCluster", 
            path: "/cluster/{clusterArn}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Modifies an elastic cluster. This includes updating admin-username/password,  upgrading the API version, and setting up a backup window and maintenance window
    ///
    /// Parameters:
    ///   - adminUserPassword: The password associated with the elastic cluster administrator.  This password can contain any printable ASCII character except forward slash (/), double quote ("), or the "at" symbol (@).  Constraints: Must contain from 8 to 100 characters.
    ///   - authType: The authentication type used to determine where to fetch the password used for accessing the elastic cluster.  Valid types are PLAIN_TEXT or SECRET_ARN.
    ///   - backupRetentionPeriod: The number of days for which automatic snapshots are retained.
    ///   - clientToken: The client token for the elastic cluster.
    ///   - clusterArn: The ARN identifier of the elastic cluster.
    ///   - preferredBackupWindow: The daily time range during which automated backups are created if automated backups are enabled, as determined by the backupRetentionPeriod.
    ///   - preferredMaintenanceWindow: The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).  Format: ddd:hh24:mi-ddd:hh24:mi   Default: a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week.  Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun  Constraints: Minimum 30-minute window.
    ///   - shardCapacity: The number of vCPUs assigned to each elastic cluster shard.  Maximum is 64. Allowed values are 2, 4, 8, 16, 32, 64.
    ///   - shardCount: The number of shards assigned to the elastic cluster. Maximum is 32.
    ///   - shardInstanceCount: The number of replica instances applying to all shards in the elastic cluster.  A shardInstanceCount value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.
    ///   - subnetIds: The Amazon EC2 subnet IDs for the elastic cluster.
    ///   - vpcSecurityGroupIds: A list of EC2 VPC security groups to associate with the elastic cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateCluster(
        adminUserPassword: String? = nil,
        authType: Auth? = nil,
        backupRetentionPeriod: Int? = nil,
        clientToken: String? = UpdateClusterInput.idempotencyToken(),
        clusterArn: String,
        preferredBackupWindow: String? = nil,
        preferredMaintenanceWindow: String? = nil,
        shardCapacity: Int? = nil,
        shardCount: Int? = nil,
        shardInstanceCount: Int? = nil,
        subnetIds: [String]? = nil,
        vpcSecurityGroupIds: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateClusterOutput {
        let input = UpdateClusterInput(
            adminUserPassword: adminUserPassword, 
            authType: authType, 
            backupRetentionPeriod: backupRetentionPeriod, 
            clientToken: clientToken, 
            clusterArn: clusterArn, 
            preferredBackupWindow: preferredBackupWindow, 
            preferredMaintenanceWindow: preferredMaintenanceWindow, 
            shardCapacity: shardCapacity, 
            shardCount: shardCount, 
            shardInstanceCount: shardInstanceCount, 
            subnetIds: subnetIds, 
            vpcSecurityGroupIds: vpcSecurityGroupIds
        )
        return try await self.updateCluster(input, logger: logger)
    }
}

extension DocDBElastic {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: DocDBElastic, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension DocDBElastic {
    /// Return PaginatorSequence for operation ``listClusterSnapshots(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listClusterSnapshotsPaginator(
        _ input: ListClusterSnapshotsInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListClusterSnapshotsInput, ListClusterSnapshotsOutput> {
        return .init(
            input: input,
            command: self.listClusterSnapshots,
            inputKey: \ListClusterSnapshotsInput.nextToken,
            outputKey: \ListClusterSnapshotsOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listClusterSnapshots(_:logger:)``.
    ///
    /// - Parameters:
    ///   - clusterArn: The ARN identifier of the elastic cluster.
    ///   - maxResults: The maximum number of elastic cluster snapshot results to receive in the response.
    ///   - snapshotType: The type of cluster snapshots to be returned. You can specify one of the following values:    automated - Return all cluster snapshots that Amazon DocumentDB has automatically created for your Amazon Web Services account.    manual - Return all cluster snapshots that you have manually created for your Amazon Web Services account.
    ///   - logger: Logger used for logging
    @inlinable
    public func listClusterSnapshotsPaginator(
        clusterArn: String? = nil,
        maxResults: Int? = nil,
        snapshotType: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListClusterSnapshotsInput, ListClusterSnapshotsOutput> {
        let input = ListClusterSnapshotsInput(
            clusterArn: clusterArn, 
            maxResults: maxResults, 
            snapshotType: snapshotType
        )
        return self.listClusterSnapshotsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listClusters(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listClustersPaginator(
        _ input: ListClustersInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListClustersInput, ListClustersOutput> {
        return .init(
            input: input,
            command: self.listClusters,
            inputKey: \ListClustersInput.nextToken,
            outputKey: \ListClustersOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listClusters(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of elastic cluster snapshot results to receive in the response.
    ///   - logger: Logger used for logging
    @inlinable
    public func listClustersPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListClustersInput, ListClustersOutput> {
        let input = ListClustersInput(
            maxResults: maxResults
        )
        return self.listClustersPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listPendingMaintenanceActions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listPendingMaintenanceActionsPaginator(
        _ input: ListPendingMaintenanceActionsInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListPendingMaintenanceActionsInput, ListPendingMaintenanceActionsOutput> {
        return .init(
            input: input,
            command: self.listPendingMaintenanceActions,
            inputKey: \ListPendingMaintenanceActionsInput.nextToken,
            outputKey: \ListPendingMaintenanceActionsOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listPendingMaintenanceActions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of results to include in the response.  If more records exist than the specified maxResults value, a pagination token (marker) is included in the response so that the remaining results can be retrieved.
    ///   - logger: Logger used for logging
    @inlinable
    public func listPendingMaintenanceActionsPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListPendingMaintenanceActionsInput, ListPendingMaintenanceActionsOutput> {
        let input = ListPendingMaintenanceActionsInput(
            maxResults: maxResults
        )
        return self.listPendingMaintenanceActionsPaginator(input, logger: logger)
    }
}

extension DocDBElastic.ListClusterSnapshotsInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> DocDBElastic.ListClusterSnapshotsInput {
        return .init(
            clusterArn: self.clusterArn,
            maxResults: self.maxResults,
            nextToken: token,
            snapshotType: self.snapshotType
        )
    }
}

extension DocDBElastic.ListClustersInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> DocDBElastic.ListClustersInput {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension DocDBElastic.ListPendingMaintenanceActionsInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> DocDBElastic.ListPendingMaintenanceActionsInput {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}
